﻿using System;
using System.Collections.Generic;
using System.Data;
using DAL;
using Entities;

namespace BLL
{
    public class BLL_TB_ThongKe
    {
        private DAL_TB_ThongKe dal_TB_ThongKe = new DAL_TB_ThongKe();

        public DataTable Get_TB_ThongKe_All()
        {
            return dal_TB_ThongKe.Get_TB_ThongKe_All();
        }

        public List<TB_ThongKe> Lst_TB_ThongKe(DataTable pdt)
        {
            List<TB_ThongKe> lstReturn = new List<TB_ThongKe>();
            if (pdt != null && pdt.Rows.Count > 0)
            {
                foreach (DataRow dr in pdt.Rows)
                {
                    TB_ThongKe tb_thongke = new TB_ThongKe();
                    tb_thongke.MaTB = (dr["MaTB"] == DBNull.Value ? 0 : Convert.ToInt32(dr["MaTB"]));
                    tb_thongke.ThoiGian = (dr["ThoiGian"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["ThoiGian"]));
                    tb_thongke.SoTruyCap = (dr["SoTruyCap"] == DBNull.Value ? 0 : Convert.ToInt32(dr["SoTruyCap"]));
                    lstReturn.Add(tb_thongke);
                }
            }
            return lstReturn;
        }
       
    }
}
